# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年08月24日
"""
from docx import Document
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT # 对齐
from docx.shared import Pt # 导入单位转换


file = Document('./练习/17结果03.docx')
file.settings.odd_and_even_pages_header_footer = True
print('默认文档奇偶页设置:', file.settings.odd_and_even_pages_header_footer)

sec1 = file.sections[0]
even_page = sec1.even_page_header
hd = even_page.paragraphs[0].add_run('这是偶数页的页眉')
hd.font.size = Pt(48)
even_page.paragraphs[0].alignment = WD_PARAGRAPH_ALIGNMENT.CENTER


file.save('./练习/19结果02.docx')
